<?php


namespace app\admin\controller;
use app\admin\model\Index as IndexModel;
use think\Controller;

class Index extends Controller
{
    public function _initialize()
    {$username = session('username');
        if (!isset($username)) {
            $this->error('请先登录','login/login');
        }
    }
    public function index(){
        //判断用户是否登录
        if(empty($mid)){
           return $this->fetch('login/login');
        }else{
           return $this->fetch('index/main');
        }
    }


    public function main(){
        $model=new IndexModel();
        $stu=$model->getuser();
        $win=$model->getclass();
        $food=$model->getfood();
        $order=$model->getorder();
        $com=$model->getcomment();
        $this->assign('stu',$stu);
        $this->assign('win',$win);
        $this->assign('food',$food);
        $this->assign('order',$order);
        $this->assign('com',$com);
       return $this->fetch();
    }
    public function tongji(){
        return $this->fetch();
    }
}